﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;
using ZHDJ.AppInterface.Common;
using ZHDJ.AppInterface.Models;
using ZHDJ.Core;

namespace ZHDJ.AppInterface.Controllers
{
    /// <summary>
    /// 考勤
    /// </summary>
    public class AttendanceController : ApiController
    {
        #region 获取考勤数据
        [HttpPost]
        public ReturnResult GetAttendance(dynamic obj)
        {
            int pageIndex = Convert.ToInt32(obj.pageIndex);
            int pageSize = Convert.ToInt32(obj.pageSize);
            DateTime startTime = Convert.ToDateTime(obj.startTime);
            DateTime endTime = Convert.ToDateTime(obj.endTime);
            List<PartyAttendance> list = InterfaceHelper.GetAttendance(pageIndex, pageSize, startTime, endTime);

            return new ReturnResult()
            {
                code = "200",
                result = list,
                msg = ""
            };
        }
        #endregion

        #region 获取会议考勤数据
        [HttpPost]
        public ReturnResult GetMeetingAttendance(dynamic obj)
        {
            int pageIndex = Convert.ToInt32(obj.pageIndex);
            int pageSize = Convert.ToInt32(obj.pageSize);
            DateTime startTime = Convert.ToDateTime(obj.startTime);
            DateTime endTime = Convert.ToDateTime(obj.endTime);
            string MeetingLectureID = Convert.ToString(obj.MeetingLectureID);
            int IsYD = Convert.ToInt32(obj.IsYD);
            List<PartyAttendance> list = InterfaceHelper.GetMeetingAttendance(pageIndex, pageSize, startTime, endTime, MeetingLectureID, IsYD);

            return new ReturnResult()
            {
                code = "200",
                result = list,
                msg = ""
            };
        }
        #endregion
    }
}
